<?php
    $x="var_dump测试";
    echo $x,"<br>";
    var_dump($x);
    echo '<br>echo用单引号，变量就会变成：','$x';


    echo '<hr>';
    echo "<hr>";
    $a=11;
    var_dump($a);
    echo "整型<br>";
    $b=1.1;
    var_dump($b);
    echo "浮点数<br>";
    $c=11e2;
    var_dump($c);
    echo "科学计数法<br>";
    $d=0x11;
    var_dump($d);
    echo "十六进制<br>";
    $e=011;
    var_dump($e);
    echo "八进制<br>";
    echo "null","<br>";
    echo $a." ",$b." ",$c;
    echo "<hr><hr>";


    define("chang1","123",);
    echo "<br>";
    echo chang1,"<br>";
    define("chanG2","456",);
    function changshu() 
    {
        echo "define默认全局变量<br>";
        ECHO chang1;


    }
    changshu();
    echo "<hr><hr>";


    $text1="文本123";
    $len1=strlen($text1);
    echo $text1,"<br>的长度是",$len1,"，一个汉字长度3<br>";
    $pos1=strpos($text1,"123");
    echo "其中123的位置在",$pos1,"，是6而不是7是因为从0开始";
    echo "<hr><hr>";


    $pos2=strpos($text1,"1234");
    echo "$pos2";
    $poscheck1=($pos2)?("存在"):("不存在");
    echo "1234的位置",$poscheck1,"<hr><hr>";

    $x=$a or false;
    echo "先算=再算or<br>";
    var_dump($x);
    echo "<br>";
    $y=$a || false;
    echo "先算||再算=<br>";
    var_dump($y);
    echo "<hr><hr>";
    $time1=date("D");
    if ($time1=="Fri")
    {
        echo "have a good holidays!";

    }
    else
    {
        echo "still need some time";
    }
    echo "<br>";

    $x=22;
    $num1=$x%2;
    echo "$x 除以2余 $num1 所以";
    switch ($num1)
    {
        case 1:
        echo "$x 是奇数";
        break;
        case 0:
        echo "$x 是偶数";
        break;
        default:echo "不是数字";
    }

?>
